home *** CD-ROM | disk | FTP | other *** search
/ HTBasic 9.3 / HTBasic 9.3.iso / SICL / data1.cab / sicl32 / vb / samples / misc / locking.bas < prev    next >
Encoding:
BASIC Source File  |  2001-03-02  |  964 b   |  48 lines

  1.  
  2. '  locking.bas
  3. Sub Main ()
  4.    Dim dvm As Integer
  5.    Dim strres As String * 20
  6.    Dim actual As Long
  7.  
  8. '  Install an error handler
  9.    On Error GoTo ErrorHandler
  10.  
  11. '  Open the multimeter session
  12.    dvm = iopen("hpib7,16")
  13.    Call itimeout(dvm, 10000)
  14.  
  15. '  Lock the multimeter device to prevent access from other applications
  16.    Call ilock(dvm)
  17.  
  18. '  Take a measurement
  19.    Call iwrite(dvm, "MEAS:VOLT:DC?" + Chr$(10), 14, 1, 0&)
  20.  
  21. '  Read the results
  22.    Call iread(dvm, strres, 20, 0&, actual)
  23.  
  24. '  Release the multimeter device for use by others
  25.    Call iunlock(dvm)
  26.  
  27. '  Display the results
  28.    MsgBox "Result is " + Left$(strres, actual)
  29.  
  30. '  Close the multimeter session
  31.    Call iclose(dvm)
  32.  
  33. '  Tell SICL to cleanup for this task
  34.    Call siclcleanup
  35.  
  36.    End
  37.  
  38. ErrorHandler:
  39.    '  Display the error message.
  40.       MsgBox "*** Error : " + Error$
  41.    '  Tell SICL to cleanup for this task
  42.       Call siclcleanup
  43.  
  44.    End
  45.  
  46. End Sub
  47.  
  48.